fix(hub-ui): clean up inactive iframe docks - #364
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
◈ PR Lens
Architecture 2 components touched across 3 lanes. Data flow
Drill down
|
There was a problem hiding this comment.
🟢 Approval recommended
The changes are focused, align with the described root cause, and are backed by targeted regressions covering the previously failing scenarios.
Pull request overview
Fixes hub UI iframe-dock cleanup so shared iframes are correctly handed off during dock switches (even with Vue clearing template refs before onUnmounted), and makes iframe location tracking cleanup resilient to cross-origin navigation edge cases.
Changes:
- Make
watchFrameLocation()cleanup tolerate inaccessible prior windows/history during navigation. - Fix
ViewIframepane ownership checks during unmount by retaining the mounted target, and unmount before disposing the location watcher. - Ensure edge dock layout hides inactive iframe panes by providing the active pane key (matching other layouts), with regression tests added for cross-origin navigation scenarios.
File summaries
| File | Description |
|---|---|
| packages/hub/src/client/frame-location.ts | Wrap listener unsubscription in try/catch to safely detach after navigation/origin changes. |
| packages/hub/src/client/tests/frame-location.test.ts | Add regressions covering cross-origin navigation and cleanup resilience; adjust fake window behavior to simulate SecurityError. |
| packages/hub-ui/src/client/components/views/ViewIframe.vue | Preserve mounted target for correct shared-iframe ownership checks; reorder teardown to unmount before disposing watchers. |
| packages/hub-ui/src/client/components/dock/DockEdge.vue | Pass active-pane key into useIframePanes() so edge layout hides inactive panes like other layouts. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Background (Why)
Vue clears template refs before
onUnmounted, soViewIframe's ownership check compares the pane target withnulland leaves the outgoing pane mounted. This cleanup defect was found while investigating reports of unrelated iframe content appearing when another dock fails to load.Changes (What)
Retain the mounted target for the ownership check, preserving shared-iframe handoffs. Unmount the pane before disposing its location watcher, tolerate origin changes during subscription cleanup, and give edge mode the inactive-pane guard already used by the other layouts.
Verification (Testing)